<!-- 我的收货地址 -->
<template>
	<view style="padding: 15px;">
		
		<view class="address-item" v-for="item in addressList">
			<p style="font-size: 0.8rem;">地址：{{item.userAddress}}</p>
			<p style="font-size: 0.8rem;">收货人：{{item.userName}}</p>
			<p style="font-size: 0.8rem;">电话：{{item.userPhone}}</p>
		</view>
		
		<button style="margin-top: 10px;" type="primary" @click="goToPage()">新建收货地址</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				addressList: [
					
				]
			}
		},
		onLoad(option) {
			
		},
		onShow() {
			this.api_addresslist()
		},
		methods: {
			goToPage() {
				uni.navigateTo({
					url: '/pages/pharmacy/addAddress'
				})
			},
			api_addresslist() {
				let openid = uni.getStorageSync('openid')
				this.$app._get('entry/wxapp/goods.addresslist', {
					openid: wx.getStorageSync("openid"),
				}, (result) => {
					this.addressList = result
					console.log(result)
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.address-item {
		padding: 10px;
		background-color: #fff;
		border-radius: 6px;
		border: 1px solid #9e9e9e;
		color: #757575;
		margin-bottom: 10px;
	}
</style>